package com.lwl.office.dcconverter.element;

import com.lwl.office.dcconverter.style.AbsDCStyle;
import com.lwl.office.webeditor.ParserContext;

import java.util.ArrayList;
import java.util.List;

/**
 * 文档节点
 */
public abstract class AbsDCElement {
    //节点的样式
    private AbsDCStyle style;
    //父节点
    private AbsDCElement parent;
    //子节点
    private List<AbsDCElement> children =new ArrayList<>();

    public void addChild(AbsDCElement child){
        if(child==null){
            return;
        }
        this.children.add(child);
        child.setParent(this);
    }
    public AbsDCStyle getStyle() {
        return style;
    }

    public void setStyle(AbsDCStyle style) {
        this.style = style;
    }

    public AbsDCElement getParent() {
        return parent;
    }

    public void setParent(AbsDCElement parent) {
        this.parent = parent;
    }

    public List<AbsDCElement> getChildren() {
        return children;
    }

    public void setChildren(List<AbsDCElement> children) {
        this.children = children;
    }

    public abstract String toHtml();

    public abstract void parseWord(ParserContext context);
}
